package com.amadues.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 自定义常规异常
 *
 * @author Amadeus
 * @date 2020/11/24
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class CustomException extends RuntimeException {

    private static final long serialVersionUID = 4564124491192825748L;

    private Integer code;

    public CustomException() {
        super();
    }

    public CustomException(int code, String message) {
        super(message);
        this.setCode(code);
    }


    public CustomException(BizCodeEnum bizCodeEnum) {
        super(bizCodeEnum.getMsg());
        this.setCode(bizCodeEnum.getCode());
    }

    public CustomException(String message) {
        super(message);
        this.setCode(500);
    }
}
